import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutterapp/config/provider_config.dart';
import 'package:flutterapp/navigator/nav.dart';

class Welcome extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Container(
          constraints: BoxConstraints.expand(height: double.infinity),
          decoration: BoxDecoration(
              image: const DecorationImage(
            image: AssetImage('assets/images/backgroup.jpg'),
            fit: BoxFit.cover,
          )),
          child: Column(
            children: <Widget>[
              Spacer(),
              Expanded(
                child: Column(
                  children: <Widget>[
                    SvgPicture.asset(
                      "assets/svg/logo.svg",
                      fit: BoxFit.fill,
                      width: 80,
                    ),
                    Text('Travel Alls', style: TextStyle(fontSize: 40)),
                    Text('The World Travel Guide, For Travel Alls',
                        style: TextStyle(fontSize: 20)),
                  ],
                ),
                flex: 5,
              ),
              Spacer(flex: 2),
              Expanded(
                child: Column(
                  children: <Widget>[
                    Container(
                        child: Row(
                      children: <Widget>[
                        Spacer(),
                        Expanded(
                          child: Container(
                              height: 50.0,
                              child: RaisedButton(
                                shape: RoundedRectangleBorder(
                                    borderRadius: BorderRadius.circular(25)),
                                color: Color.fromARGB(255, 58, 125, 148),
                                child: new Text(
                                  "Begin",
                                  style: new TextStyle(
                                    fontSize: 18.0,
                                    color: Colors.white,
                                  ),
                                ),
                                onPressed: () => Navigator.push(
                                    context,
                                    MaterialPageRoute(
                                        builder: (context) => NavStatefulWidget())),
                              )),
                          flex: 10,
                        ),
                        Spacer(),
                      ],
                    ))
                  ],
                ),
              ),
              Expanded(
                child: RichText(
                    text: TextSpan(
                        text: 'i have a account',
                        style: TextStyle(fontSize: 20.0),
                        children: [
                      TextSpan(
                          text: 'Login',
                          recognizer: TapGestureRecognizer()
                            ..onTap = () => Navigator.push(context, MaterialPageRoute(builder: (context) => ProviderConfig.getInstance().getLoginPage())),
                          style: TextStyle(
                              fontSize: 20.0,
                              color: Color.fromARGB(255, 58, 125, 148)))
                    ])),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
